<?php
/**
 * Created by PhpStorm.
 * User: zhangrongxiang
 * Date: 2018/2/11
 * Time: 下午11:09
 */

$input   = array( "oranges", "apples", "pears" );
$flipped = array_flip( $input );
print_r( $flipped );
echo "apples -> " . $flipped['apples'] . PHP_EOL;
echo "apples -> " . $flipped[ $input[1] ] . PHP_EOL;
//////////////////////////////////////////////////////
if ( isset( $flipped['oranges'] ) ) {
	echo 'oranges exists!' . PHP_EOL;
}
if ( in_array( 'oranges', $flipped ) ) {
	echo 'oranges exists!' . PHP_EOL;
}
//////////////////////////////////////////////////////
$flipped = array_flip( $flipped );
if ( $input === $flipped ) {
	echo "input === flipped";//true
}